package com.wall.haven.dto;

import com.wall.haven.entity.UpdateLog;

import java.time.format.DateTimeFormatter;
import java.util.List;

public class UpdateLogDTO {

    private String version;

    /**
     * 更新信息
     */
    private List<String> notes;

    /**
     * 发布时间
     */
    private String releaseTime;

    public UpdateLogDTO() {
    }

    public UpdateLogDTO(UpdateLog updateLog) {
        this.version = updateLog.getVersion();
        this.notes = List.of(updateLog.getNotes().split("\\r\\n"));
        this.releaseTime = updateLog.getReleaseTime().format(DateTimeFormatter.ISO_DATE);
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public List<String> getNotes() {
        return notes;
    }

    public void setNotes(List<String> notes) {
        this.notes = notes;
    }

    public String getReleaseTime() {
        return releaseTime;
    }

    public void setReleaseTime(String releaseTime) {
        this.releaseTime = releaseTime;
    }
}
